package com.shops.servlet.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author gexiang
 * @Description:
 * @date 2020/7/1814:19
 */
public class Filter1 implements Filter {
    private String tel;

    private String username;

    private String password;

    private String email;

    private String address;

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("");
        ServletContext servletContext = filterConfig.getServletContext();
        Object str = servletContext.getAttribute("str");
        System.out.println("过滤器开始初始化"+str);

        System.out.println("gexiang");

        System.out.println("sfsfdfds");

        System.out.println("sfasdfas");

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("开始执行过滤器");
        filterChain.doFilter(servletRequest, servletResponse);
        System.out.println("拦截器执行结束");
    }

    @Override
    public void destroy() {
        System.out.println("过滤器开始销毁");
    }
}
